<?php

/**
 * Payments form base class.
 *
 * @method Payments getObject() Returns the current form's model object
 *
 * @package    dashboard
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePaymentsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'payment_id'         => new sfWidgetFormInputHidden(),
      'payment_type'       => new sfWidgetFormChoice(array('choices' => array('incoming' => 'incoming', 'outgoing' => 'outgoing'))),
      'payment_amount'     => new sfWidgetFormInputText(),
      'payment_date'       => new sfWidgetFormDateTime(),
      'payment_ext_data'   => new sfWidgetFormInputText(),
      'payment_method'     => new sfWidgetFormInputText(),
      'payment_method_num' => new sfWidgetFormInputText(),
      'payment_approved'   => new sfWidgetFormChoice(array('choices' => array('yes' => 'yes', 'no' => 'no'))),
      'invoice_id'         => new sfWidgetFormInputText(),
      'invoice_group'      => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'payment_id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('payment_id')), 'empty_value' => $this->getObject()->get('payment_id'), 'required' => false)),
      'payment_type'       => new sfValidatorChoice(array('choices' => array(0 => 'incoming', 1 => 'outgoing'))),
      'payment_amount'     => new sfValidatorNumber(),
      'payment_date'       => new sfValidatorDateTime(),
      'payment_ext_data'   => new sfValidatorString(array('max_length' => 255)),
      'payment_method'     => new sfValidatorString(array('max_length' => 30)),
      'payment_method_num' => new sfValidatorString(array('max_length' => 30)),
      'payment_approved'   => new sfValidatorChoice(array('choices' => array(0 => 'yes', 1 => 'no'), 'required' => false)),
      'invoice_id'         => new sfValidatorInteger(),
      'invoice_group'      => new sfValidatorInteger(),
    ));

    $this->widgetSchema->setNameFormat('payments[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Payments';
  }

}
